﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
namespace DAL
{
    public class user:ketnoi
    {
        public bool xoa(string ID)
        {
            using (SqlCommand dbCmd = new SqlCommand("tblUser_Delete", GetConnection()))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@ID", ID));
                dbCmd.ExecuteNonQuery();
            }
            return true;

        }
        public DataTable tk(string ID)
        {
            DataTable dt = new DataTable();
            using (SqlCommand dbCmd = new SqlCommand("tblUser_GetByID", GetConnection()))
            {
                SqlDataAdapter da = new SqlDataAdapter(dbCmd);
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@ID", ID));
                da.Fill(dt);
                dbCmd.ExecuteNonQuery();
            }
            return dt;

        }
        public DataTable xem()
        {
            DataTable dt = new DataTable();
            using (SqlCommand dbCmd = new SqlCommand("tblUser_SelectAll", GetConnection()))
            {
                SqlDataAdapter da = new SqlDataAdapter(dbCmd);
                dbCmd.CommandType = CommandType.StoredProcedure;
                da.Fill(dt);
                dbCmd.ExecuteNonQuery();
            }
            return dt;

        }
    }
}
